package com.xctech.iot.rocketmq.consumer;


import com.xctech.iot.rocketmq.msg.MqttExchangeMessage;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * <pre>
 * 事件、属性消息上报
 * </pre>
 *
 * @author: feihu.liang
 * @since: 2024/4/30 10:50
 */
@Slf4j
@Component
@RequiredArgsConstructor
@RocketMQMessageListener(topic = "flcss_iot_mqtt_event_post",
		consumerGroup = "event_post_group",
		consumeMode = ConsumeMode.CONCURRENTLY, messageModel = MessageModel.CLUSTERING
)
public class EventPostMessageConsumer implements RocketMQListener<MqttExchangeMessage> {

	// todo 注入消息处理类，入库mysql存储 等操作
	// private final MqttEventMessageHandler mqttEventMessageHandler;

	@Override
	public void onMessage(MqttExchangeMessage exchangeMessage) {
		log.info("[EventPostMessageConsumer] topic={}, msg={}", exchangeMessage.getTopic(), exchangeMessage.getPayload());
		// fixme MqttExchangeMessage 消息格式可以自定义

	}

}
